const assert = require('assert')
const { Given, When, Then } = require('@cucumber/cucumber')
const { getUser } = require('../../apollo')
Given('I start with pwd {string}', function (pwd) {
  this.pwd = pwd
})
When('I login username is {string}', function (username) {
  return getUser(username, this.pwd).then((user) => {
    this.user = user
  })
})
Then('login user is {string} type is {string}', function (username, type) {
  assert.equal(this.user.username, username)
  assert.equal(this.user.type, type)
})
